package tools;

import java.util.List;

/**
 * Created by TJ on 2016/5/20.
 */
public class StringTools {
    /**
     * 将List集合中项使用逗号分隔
     * @param list
     * @param <T>
     * @return
     */
    public static <T> String separateWithComma(List<T> list) {
        if (list == null || list.size() == 0) return null;
        StringBuilder sb = new StringBuilder();
        for (T str : list) {
            sb.append(str).append(",");
        }
        return sb.deleteCharAt(sb.length()-1).toString();
    }
}
